package com.kaifamiao.io.d0922;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.*;
import java.util.Properties;

public class PropertiesDemo1 {

    public static void main(String[] args) {
        // Map  --> values()   keySet()  entrySet()
        Properties prop = new Properties();

        prop.put("url", "jdbc:mysql://10.0.2.60:3306/kfm");
        prop.put("driver", "com.mysql.cj.jdbc.Driver");
        prop.put("user", "root");
        prop.put("password", "");

        try(FileOutputStream fos = new FileOutputStream("a.xml");){
//            prop.store(fos, "test");
            prop.storeToXML(fos, "test1");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
